<?php
/**
 * Created by PhpStorm.
 * User: zhengze
 * Date: 2019/7/1
 * Time: 18:29
 */

namespace app\api\validate;

use app\api\enum\ScopeEnum;
use app\api\service\Token;
use common\traits\InstanceTrait;
use app\lib\exception\TokenException;

/**
 * Class RecordValidate
 * 验证类的基类
 */
class RecordValidate extends BaseValidate
{
    use InstanceTrait;

    /**
     * 定义验证规则
     * 格式：'字段名|字段中文名'    =>    ['规则1','规则2'...]
     * @var array
     */
    protected $rule = [
        'type|使用类型' => ['require', 'between:1,5', 'isNotEmpty'],
        'content|使用方式' => ['require', 'length:1,10', 'isNotEmpty'],
        'exe_date|使用时间' => ['require', 'date', 'isNotEmpty'],
    ];

    protected $sceneRule = [
        'save' => [
            'only' => ['type', 'content', 'exe_time'],
        ],
    ];
}